package com.tzu.seq;

import com.tzu.seq.bean.SeqConfig;
import lombok.extern.log4j.Log4j2;
import thirdpart.codec.BodyCodec;

import java.io.FileInputStream;
import java.io.InputStream;

/**
 * @Author: Tzu
 * @Date: 2020/11/29 16:27
 * @Version: 1.0
 * @Description:
 */
@Log4j2
public class SeqStartup2 {


    public static void main(String[] args) throws Exception {
        //加载配置文件
        String configFileName = "seq2.properties";
        InputStream inputStream ;
        try {
            // 配置文件在jar包同级目录下
            inputStream = new FileInputStream(System.getProperty("user.dir") + "\\" + configFileName);
            log.info("seq2.properties exist in jar path");
        }catch (Exception e){
            // 配置文件在jar包里面
            inputStream = SeqStartup1.class.getResourceAsStream("/" + configFileName);
            log.info("seq2.properties exist in jar file");
        }

        new SeqConfig(inputStream,new BodyCodec()).startup();
    }

//    public static void main(String[] args) throws Exception {
//        String configName = "seq2.properties";
//        new SeqConfig(configName,new BodyCodec()).startup();
//    }

}
